import Instance from '@/utils/http.ts';


// 通过id删除一条数据
export function useDeleteOneByIdAPI(id:number) {
    return Instance({
        url:`/equip-transfer/${id}`,
        method:'DELETE'
    })
}


// 分页获取所有数据
export function useGetAllEquipmentTransferFormAPI(current:number,pageSize:number){
    return Instance({
        url:'/equip-transfer/getAllByPage',
        method:'GET',
        params: {current: current, pageSize: pageSize}
    })
}


// 配合分页获取所有数据接口 获取所有数据行条数

export function useGetAllEquipmentTransferCountAPI(){
    return Instance({
        url:'/equip-transfer/getAllCounts',
        method:'GET',
    })
}


// 在detail页面中下载附件并打包
export function useDownPhotosAPI(fileList:[]){
    return Instance({
        url:'/equipment/downLoadFiles',
        method:'POST',
        data:fileList,
        responseType:'blob',
    })
}


// 新增加一条设备出场表单
export function saveOneEquipmentTransferAPI(formData:FormData){
    return Instance({
        url:'/equip-transfer/saveOneByEqId',
        method:'POST',
        data:formData,
        headers:{
            'content-type': 'multipart/form-data'
        },
    })
}

// 修改一条设备出场表单
export function modifyOneEquipmentTransferAPI(formData:FormData){
    return Instance({
        url:'/equip-transfer/modifyOne',
        method:'PUT',
        data:formData,
        headers:{
            'content-type': 'multipart/form-data'
        },
    })
}


export function useGetByALLTypeNameAPI(name: string, current: number, pageSize: number){
    return Instance({
        url:'/equip-transfer/getAllByAllTypeName',
        method:'GET',
        params:{
            name,current,pageSize
        }
    })
}

// 多功能查询获取到的全部数据条数
export function useGetAllByTypeNameCountsAPI(name:string){
    return Instance({
        url:'/equip-transfer/getAllByTypeNameCounts',
        method:'GET',
        params:{
            name
        }
    })
}


// 根据两个时间查询数据
export function useGetByBetweenTimeAPI(start: Date,end:Date, current: number, pageSize: number){
    return Instance({
        url:'/equip-transfer/getByBetweenTimes',
        method:'GET',
        params:{
           start,end,current,pageSize
        }
    })
}

// 根据两个时间查询数据条数
export function useGetByBetweenTimesCountSAPI(start: Date,end:Date){
    return Instance({
        url:'/equip-transfer/getByBetweenTimesCountS',
        method:'GET',
        params:{
           start,end
        }
    })
}

// 根据id获取一条数据
export function useGetOneByIdAPI(id:number){
    return Instance({
        url:`/equip-transfer/${id}`,
        method:'GET',
    })
}










